/**
 * zhangqiang    2017.04.26
 * 空白页面，此页面为了防止旧版本回退后出现双标题，6.3之后已取消web自定义标题，改用原生的标题，2017.11.8编辑
 */
import React, { Component } from 'react'
import { connect } from 'react-redux'
import Login from '../../utils/loginOperation_bak'

// 加载组件
import { Toast } from 'antd-mobile'

//依赖
import jsApi from '../../utils/cx580.jsApi'
import Common from '../../utils/common'
import urlOperation from "../../utils/urlOperation";
import appVersion from "../../utils/appVersion";

/**
 * 组件
 */

class APPjumpUrl extends Component {
	constructor(props) {
		super(props);
		this.orderId =this.props.params.orderId
	}

	/**
	 * 生命周期
	 */
	componentDidMount() {
		Toast.loading('请稍等');
		//localStorage.setItem('detailUserType', 'app')
		Login.appLogin(() => {
			let showTitle='true';
			//详情
			let urlOfNow = window.location.href;
			let APPbaseApiUrl = urlOfNow.replace(window.location.hash, '').split('?')[0].replace('#/', '');

            if (appVersion.getMainVersionByCount()<6.3) {
                jsApi.call({
                    "commandId": "",
                    "command": "close",
                    "data": {}
                }, function () {
                });
                //版本控制，6.3之后取消自定义标题，此处应该不隐藏标题，待旧版本更新完毕之后可将次页面去除，直接开新页面跳转到annualInspection（api_version为新sdk标识，6.3以上会有api_version）

                showTitle = 'false';

                jsApi.call({
                    'commandId': '',
                    'command': 'openNewBrowserWithURL',
                    'data': {
                        'url': `${APPbaseApiUrl}#/annualInspection/${this.orderId}/shut`,
                        'umengId': 'cfw_youkachongzhi',
                        'showTitleLayout': showTitle //是否显示到导航栏
                    }
                }, function (data) {

                });
            }
            else{
                this.context.router.replace(`annualInspection/${this.orderId}/shut`);
			}
		})
	}
	/**
	 * 事件 
	 */


	/**
	 * 组件
	 */
	render() {

		return (
			<div>
			</div>
		)
	}
}

APPjumpUrl.contextTypes = {
	router: React.PropTypes.object.isRequired
}

APPjumpUrl.defaultProps = {

};

export default connect()(APPjumpUrl)